package com.appkubes.mall.restful.application.system.config.service.impl;

import com.appkubes.mall.core.entity.MallSystemConfigGlobal;
import com.appkubes.mall.core.po.MallSystemConfigGlobalExample;
import com.appkubes.mall.restful.application.system.config.dao.ConfigGlobalDao;
import com.appkubes.mall.restful.application.system.config.service.ConfigGlobalService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ConfigGlobalServiceImpl implements ConfigGlobalService {

    @Resource
    ConfigGlobalDao configGlobalDao;


    @Override
    public String getConfigValue(ConfigGlobalEnum configGlobalEnum) {
        QueryWrapper<MallSystemConfigGlobal> queryWrapper = new QueryWrapper<>();
        MallSystemConfigGlobal mallSystemConfigGlobal = new MallSystemConfigGlobal();
        mallSystemConfigGlobal.setSystemCode(configGlobalEnum.systemCode);
        mallSystemConfigGlobal.setConfigTypeCode(configGlobalEnum.configTypeCode);
        mallSystemConfigGlobal.setConfigCode(configGlobalEnum.configCode);
        queryWrapper.setEntity(mallSystemConfigGlobal);
        MallSystemConfigGlobal result = configGlobalDao.selectOne(queryWrapper);
        return result.getConfigValue();
    }
}
